/**
 * 
 */
package com.example.rabbitmqTest;

/**
 * @author yanglei
 *
 * 2018年1月14日
 */
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;  
  
/** 
 * mq消费者 
 * Created by zhonglinsen on 2017/11/30. 
 */  
@Component  
@RabbitListener(queues = "${mq.first.queue}")  
public class MqReceiver {  
  
    private static final Logger log= LoggerFactory.getLogger(MqReceiver.class);  
  
    @Autowired  
    private AmqpTemplate rabbitTemplate;  
  
    @RabbitHandler  
    public void receive(String message){  
        log.debug("mq消费者接受消息： {} ",message);  
    }  
}  
